package com.xm_jd.controller.dd;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xm_jd.model.dao.Index2Dao_Pj;
import com.xm_jd.model.entitys.tb_pj;
import com.xm_jd.utils.BaseServlet;

/**
 * Servlet implementation class pj_tj
 */
@WebServlet("/pj_tj")
public class pj_tj extends BaseServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public pj_tj() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String spid=request.getParameter("spid");//商品id
		String yhid=request.getParameter("yhid");//用户id
		String f = request.getParameter("dj");//评价等级
		String pj = request.getParameter("pj");//评价内容
		String ddid = request.getParameter("ddid");//订单编号
		Date day=new Date();    
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
		String data =	df.format(day); 	//评价时间
		
		if(pj!=null){
		int id = Integer.parseInt(spid);
		int dj = Integer.parseInt(f);
		tb_pj entity = new tb_pj();
		entity.setPj_shoop_id(id);
		entity.setPj_yh_id(yhid);
		entity.setPj_dj(dj);
		entity.setPj_nr(pj);
		entity.setPj_time(data);
		new Index2Dao_Pj().zhenjpj(entity);
		new Index2Dao_Pj().updateorder(Integer.parseInt(ddid));
		
	}
		
	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
